-- ship_burn
-- created by wangy
-- 天空之城飞船燃烧

return {
    apply = function(prop, baseValue)
        return prop[3];
    end,

    -- 每回合触发
    trigger = function(who, prop, arg)
        local damage = prop[3];

        -- 最小一点
        damage = math.max(1, damage);

        local stoneProp = who.dbase:query("stone_prop", {});
        if stoneProp["disable_debuff"] == 1 then
            damage = 0;
        end

        trace("ship_burn", "%s燃烧，损失 %d 滴血。", who:getName(), damage);

        who:receiveDamage(damage);

        -- 抛出属性效果时间
        EventMgr.fire(event.SKY_COMBAT_PROP_EFFECT, {["fighter"] = who, ["type"] = "burn", ["damage"] = damage, });

        return {["damage"] = {["type"] = "ship_burn", ["damage"] = damage, }};
    end,

    desc = function(prop)
        local row = PropM.getRow(prop[1]);
        local desc = row.desc;

        desc = string.gsub(desc, "{2}", prop[4]);

        return desc;
    end,

    record = function(target, prop, path)
        return false;
    end
};
